<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="${package.Mapper}.${table.mapperName}">

    <select id="getList" parameterType="${entity}" resultType="${entity}">
        select v.* from ${table.name} v
        <where>
        <#list table.fields as field>
            ${r'<if'} test="value.${field.propertyName} != null">
            <#if field.name == "create_time" || field.propertyType == "LocalDateTime" || field.propertyType == "LocalDate">
                and v.${field.name} between ${r'#{value.createTime}'} and ${r'#{value.updateTime}'}
            <#elseif field.likeSearch>
                <bind name="${field.propertyName}Like" value="'%' + value.${field.propertyName} + '%'"/>
                and v.${field.name} like ${r'#{'}${field.propertyName}Like}
            <#else>
                and v.${field.name} = ${r'#{value.'}${field.propertyName}}
            </#if>
            ${r'</if>'}
        </#list>
        </where>
        order by v.create_time desc
    </select>

</mapper>
